SRCS = $(shell find . -name "*.c" -type f)

PRES = $(SRCS:.c=.pre)
ASMS = $(SRCS:.c=.asm)
OBJS = ${SRCS:.c=.obj}
OUTS = ${SRCS:.c=.out}

%.pre: %.c
	gcc -E -P $< -o $@

%.asm: %.c
	gcc -S -masm=intel $< -o $@

%.obj: %.c
	gcc -c $< -o $@

%.out: %.c
	gcc $< -o $@

buildpre: $(PRES)
buildasm: $(ASMS)
buildobj: $(OBJS)
buildout: $(OUTS)

strip: $(OUTS)
	strip --strip-all $^

clean:
	find . -type f -name "*.pre" -delete
	find . -type f -name "*.asm" -delete
	find . -type f -name "*.obj" -delete
	find . -type f -name "*.out" -delete
	
.PHONY: buildpre buildasm buildobj buildout strip clean